module Pan

  class ErrorInformer < Component
    
    attr_accessor :show_levels, :show_lines
    
    def initialize(e, owner)
      @exception = e
      @owner = owner
      @show_levels = 3
      @show_lines = 3
    end

    def render_on(html)
      html.heading("Error during render phase")
      html.link("Information about error") {
        @owner.pop
        session.root_push(Backtrace.new(@exception, self))
      }
      html.lit(" | ")
      html.anchor("href"=>session.req.base_url) { html.lit("New session") }
    end
  end
end
